package com.gdqy.FCS.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gdqy.FCS.dao.ClothingDao;
import com.gdqy.FCS.entity.Clothing;
@Service
@Transactional
public class ClothingService {
	@Autowired
	private ClothingDao clothingDao;
	
	public Clothing selectById(int id){
		return clothingDao.selectById(id);
	}
	public int selectCountByEnterprise_id(int enterprise_id){
		return clothingDao.selectCountByEnterprise_id(enterprise_id);
	}
	public List<Clothing> selectByLiked(){
		return clothingDao.selectByLiked();
	}
	//查找匹配设计作品的服装
	public List<Clothing> selectMatchDesignClothing(String type_code, String style_code, String pattern_code, String component_code){
		return clothingDao.selectMatchDesignClothing(type_code, style_code, pattern_code, component_code);
	}
	//查找相似的服装
	public List<Clothing> selectSimilarClothing(String type_code,String style_code,String pattern_code,String component_code,
			String weave_code,String color,String season,int id){
		return clothingDao.selectSimilarClothing(type_code, style_code, pattern_code, component_code, weave_code, color, season, id);
	}
	//查询服装 总数
	public int selectAllCount(){
		return clothingDao.selectAllCount();
	}
	//根据品牌查询服装总数
	public int selectCountByBrand_id(int brand_id){
		return clothingDao.selectCountByBrand_id(brand_id);
	}
	
	//通过面料编号查询服装
	public  List<Clothing> selectByFabric_code(String component_code){
		return clothingDao.selectByFabric_code(component_code);
	}
	
	//通过id删除服装
	public int deleteById(int enterprise_id){
		return clothingDao.deleteById(enterprise_id);
	}
	//通过品牌id查询服装
	public List<Clothing> selectByBrand_id(int brand_id){
		return clothingDao.selectByBrand_id(brand_id);
	}
	//修改处
	//通过服装类和品牌id查询服装
	public List<Clothing> selectClothingByClothingTypeAndBrand(String code,String brand_id,String style_code){
		return clothingDao.selectClothingByClothingTypeAndBrand(code,brand_id,style_code);
	}
	//新增服装
	public int insert(Clothing clothing){
		return clothingDao.insert(clothing);
	}
	//更新服装
	public int update(Clothing clothing) {
		return clothingDao.update(clothing);
	}
	
	public List<Clothing> selectClothingByTypeAndBrand(String big_code,String middle_code,String small_code,int brand_id){
		return clothingDao.selectClothingByTypeAndBrand(big_code, middle_code, small_code, brand_id);
	}
	//通过服装的人气获得企业的总人气
	public int selectPopularityByEnterprise_id(int enterprise_id) {
		return clothingDao.selectPopularityByEnterprise_id(enterprise_id);
	}
}
